package com.shansun.xml
{
	import com.shansun.dataobj.ClassDesc;
	import com.shansun.dataobj.MethodDesc;

	public class ToXmlBuilder
	{
		public function ToXmlBuilder()
		{
		}
		
		public static function toXmlTreeData(clazzInfos:Array):XML 
		{
			var xml:XML = <nodes></nodes>;
			var dataIndex:int = 1;
			for each(var clazz:ClassDesc in clazzInfos)
			{ 
				var node:XML = <node label={clazz.name} data="-1"></node>;
				for each(var m:MethodDesc in clazz.methods)
				{
					var mNode:XML = <node label={m.name} data={dataIndex++}></node>;
					node.appendChild(mNode);
				}
				xml.appendChild(node);
			}
			return xml;
		}
	}
}